package BNS.graphs;

import java.io.File;

import javax.swing.JFrame;

import BNS.plumbing.Library;


/** A class used only for debugging and testing.
	It creates a Graph from a certain matrix file,
	prints some information about it,
	and prompts the user for a filename to store it in.
	*/
public class Test {
	
	/** invoked from command line. Needs no parameters.
		*/
	public static void main(String[] args) {
		JFrame frame= new JFrame("GraphPack Creation");
		frame.setSize(500,500);
		Creator crPanel= new Creator();
		frame.setContentPane(crPanel);
		frame.validate();
		frame.setVisible(true);	// must come BEFORE init, so that getSize() works
		Graph gr;
		/*gr= new Graph(5,5);
		Node n1= gr.addNode("n1");
		Node n2= gr.addNode("n2");
		Node n3= gr.addNode("n3");
		gr.addEdge(n1,n2);
		gr.addEdge(n2,n3);
		gr.addEdge(n3,n1);
		 */
		gr= MatrixGraph.create(new File("prepped/Zmatrices/boxChord.matrix")); 
		gr.prettyPrint(System.err);
		GraphPack gp= new GraphPack(gr,"creation model: test");
		crPanel.init(gr);
		try { synchronized(crPanel) { crPanel.wait(); } }// Creator's "next" button will kick this
		catch(InterruptedException ie) {}
		System.err.println("done one");
		Library.putPack(frame,gp); // new File(gfld)
		System.err.println("saved gpack");

//		buildLayouts(gp,crPanel,2); 
		}
	
	}
